package cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.supplier.dal.mysql.supplier;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.supplier.controller.admin.supplier.vo.SupplierExportReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.supplier.controller.admin.supplier.vo.SupplierPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.mini.goodInfo.supplier.dal.dataobject.supplier.SupplierDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 小程序-供应商 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SupplierMapper extends BaseMapperX<SupplierDO> {

    default PageResult<SupplierDO> selectPage(SupplierPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplierDO>()
                .betweenIfPresent(SupplierDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(SupplierDO::getName, reqVO.getName())
                .likeIfPresent(SupplierDO::getNickName, reqVO.getNickName())
                .eqIfPresent(SupplierDO::getPhone, reqVO.getPhone())
                .eqIfPresent(SupplierDO::getInfos, reqVO.getInfos())
                .orderByDesc(SupplierDO::getId));
    }

    default List<SupplierDO> selectList(SupplierExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<SupplierDO>()
                .betweenIfPresent(SupplierDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(SupplierDO::getName, reqVO.getName())
                .likeIfPresent(SupplierDO::getNickName, reqVO.getNickName())
                .eqIfPresent(SupplierDO::getPhone, reqVO.getPhone())
                .eqIfPresent(SupplierDO::getInfos, reqVO.getInfos())
                .orderByDesc(SupplierDO::getId));
    }

}
